Hello to the wonderful world of programmers
I am having a great deal trouble with a matrix/arrays.
I need to set up a user defined array n by m
and then get the use to enter values into it, but i cant make any progress, so far i have (taken mostly for other threads on this board)
Code:
#include <stdio.h>
int main()
{
int nSIZE = 1;
double *ptr;
int i,j;
while(nSIZE != 0)
{
printf("enter size : \n");
scanf("%d", &nSIZE);
ptr = (double *)malloc(sizeof(double)*nSIZE*nSIZE);
printf("please enter each value of the matrix: \n");
for(i=0;i<nSIZE;i++)
{
for(j=0;j<nSIZE;j++)
{
scanf( "%d", &ptr[i] );
(ptr[i]) = j;
printf("%d", (ptr[i]));
}
printf("\n");
}
for(i=0;i<nSIZE;i++)
{
for(j=0;j<nSIZE;j++)
{
printf("%d", ptr[i][j]);
}
free(ptr);
}
}
Thanks for any help!!